package com.pearadmin.modules.blog.mapper;

import com.pearadmin.modules.blog.domain.Label;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface LabelMapper {

    /**
     * 插入
     * @param label
     * @return
     */
    @Insert("INSERT INTO label(lable_name,sort) VALUES(#{lableName},10)")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insert(Label label);

    @Select("SELECT * FROM `label` WHERE lable_name=#{lableName}")
    Label selectByName(String lableName);

    @Select("SELECT * FROM `label`")
    List<Label> selectAll();


}
